package com.example.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.blog.pojo.FriendRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FriendRequestMapper extends BaseMapper<FriendRequest> {

    @Select("select user_id,friend_id,status,create_time from friend_request where user_id=#{userId}")
    List<FriendRequest> showFriendsApply(@Param("userId") Integer userId);

    @Select("SELECT * FROM friend_request WHERE user_id = #{friendId} AND friend_id = #{userId}")
    FriendRequest addFriends(@Param("friendId") int friendId, @Param("userId") int userId);
}
